<?php 
$total = count($adc->getAdCats());
if($total > 1)
{
	$cols = $adc->getSetting('CatListCols');
	$rows = ceil($total / $cols);
	
	$i = 1;
	$j = 1;
	$k = 1;
    
	foreach($adc->getAdCats() as $cat)
	{
		$link = $katana->getURL().$cat->getLink();
		$row[$i][$j]  = '<td height="24" class="text-center text-bottom">';
		if(is_object($cat->getImageObject()))
		{ $row[$i][$j] .= '<a href="'.$link.'"><img title="'.$cat->getTitle().'" src="'.$cat->getImageObject()->getLink($adc->getSetting('CatListW'), $adc->getSetting('CatListH')).'" alt="'.$cat->getTitle().'" /></a>'; }
		$row[$i][$j] .= '</td>';
		$row[$i][$j] .= '<td class="text-left text-bottom"><a href="'.$link.'">'.$txt->truncate(ucfirst($cat->getTitle()), 25, '', '').'</a></td>';

		$j++;
		if(($k % $rows) == 0)
		{ 
			$i++; 
			$j=1;
		}
		$k++;
	}
	?>
    <div class="row-fluid">
        <table class="adcats" cellpadding="0" cellspacing="0" border="0" style="width: 100%;">
            <tr>
            <?php
            $i = 1;
            foreach($row as $list)
            {
                ?>
                <td class="top left">
                    <table class="adcats" cellpadding="0" cellspacing="0" border="0" style="width: 100%;">
    
                            <?php 
                            foreach($list as $cat)
                            {
                                echo '<tr>';
                                echo $cat;
                                echo '</tr>';
                            }
                            ?>
                    </table>
                </td>
                <?php
                $i++;
            }
            ?>
            </tr>
        </table><div class="v-space"></div>
    </div>
	<?php
}
?>